﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Linq;

namespace admin
{
    public class serverManager
    {
        private static ServiceReference1.Service1Client sc = new admin.ServiceReference1.Service1Client();

        internal static ServiceReference1.Service1Client getPox()
        {
            if (sc.State == System.ServiceModel.CommunicationState.Created)
            {
                App myapp = App.Current as App;
                var serverurl = myapp.input.First(d => d.Key == "server");
                sc.Endpoint.Address = new System.ServiceModel.EndpointAddress(serverurl.Value);
                return sc;
            }
            else
            {
                return sc;
            }
        }
    }
}
